<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/public/inc/tags.jsp"%>
<input type="hidden" value="${model.id}" name="id">
<input type="hidden" value="${model.themeid}" name="themeid">
<div class="form-horizontal">
    <div class="form-group">
        <label class="control-label col-md-2">标题</label>
        <div class="col-md-10">
            <input type="text" id="title" name="title" class="form-control" placeholder="请输入标题"
                   value="${model.title}"/>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-md-2">点击量</label>
        <div class="col-md-10">
            <input type="text" id="virtual_click_count" name="virtual_click_count" class="form-control" placeholder="请输入点击量"
                   value="${model.virtual_click_count}"/>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-md-2">是否启用</label>
        <div class="col-md-10">
            <select name="status" class="form-control">
                <option value="0">请选择</option>
                <option value="1" <c:if test="${model.status==1}"> selected="selected"</c:if>>否</option>
                <option value="0" <c:if test="${model.status==0}"> selected="selected"</c:if>>是</option>
            </select>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-md-2">现价</label>
        <div class="col-md-10">
            <input type="text" id="price" name="price" class="form-control" placeholder="请输入现价"
                   value="${model.price}"/>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-md-2">原价</label>
        <div class="col-md-10">
            <input type="text" id="original_price" name="original_price" class="form-control" placeholder="请输入原价"
                   value="${model.original_price}"/>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-md-2">排序</label>
        <div class="col-md-10">
            <input type="text" id="sort" name="sort" class="form-control" placeholder="请输入排序"
                   value="${model.sort}"/>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-md-2">书单类型描述</label>
        <div class="col-md-10">
            <input type="text" id="themedesc" name="themedesc" class="form-control" placeholder="请输入描述"
                   value="${model.themedesc}"/>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-md-2">书籍列表</label>
        <div class="col-md-10">
            <input type="text" id="book_list" name="book_list" class="form-control" placeholder="以英文逗号分隔"
                   value="${model.book_list}"/>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-md-2">书籍列表总时长</label>
        <div class="col-md-10">
            <input type="text" id="total_duration" name="total_duration" class="form-control" placeholder="请输入书籍列表总时长"
                   value="${model.total_duration}"/>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-md-2">类型</label>
        <div class="col-md-10">
            <select name="type" class="form-control">
                <option value="0">请选择</option>
                <option value="0" <c:if test="${model.type==0}"> selected="selected"</c:if>>精品课</option>
                <option value="1" <c:if test="${model.type==1}"> selected="selected"</c:if>>书单列表</option>
                <option value="2" <c:if test="${model.type==2}"> selected="selected"</c:if>>小程序课程</option>
            </select>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-md-2">推荐首页</label>
        <div class="col-md-10">
            <select name="ishost" class="form-control">
                <option value="0">请选择</option>
                <option value="0" <c:if test="${model.ishost==0}"> selected="selected"</c:if>>否
                </option>
                <option value="1" <c:if test="${model.ishost==1}"> selected="selected"</c:if>>是
                </option>
            </select>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-md-2">限免活动</label>
        <div class="col-md-10">
            <select name="activity2" class="form-control">
                <option value="0">请选择</option>
                <option value="0" <c:if test="${model.activity2==0}"> selected="selected"</c:if>>正常</option>
                <option value="1" <c:if test="${model.activity2==1}"> selected="selected"</c:if>>上新</option>
                <option value="2" <c:if test="${model.activity2==2}"> selected="selected"</c:if>>限免</option>
                <option value="3" <c:if test="${model.activity2==3}"> selected="selected"</c:if>>折扣</option>
                <option value="4" <c:if test="${model.activity2==4}"> selected="selected"</c:if>>热销</option>
            </select>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-md-2">限免结束时间</label>
        <div class="col-md-10">
            <fmt:formatDate value="${model.activity2_end_time}" pattern="yyyy-MM-dd HH:mm:ss" var="end_time"/>
            <input type="text" readonly="readonly" id="activity2_end_time" name="activity2_end_time"
                   class="form-control" placeholder="请输入限免结束时间"
                   value="${end_time}"/>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-md-2">封面图片</label>
        <div class="col-md-10">
            <input type="hidden" name="img" value="${model.img}"/>
            <input type="file" class="btn btn-primary" id="img" name="ImgFile"/>
            <img src="http://img.readerday.com/cover/${model.img}" class="thumbnail" style="height: 200px;
            <c:if test="${model.img==null}">display: none;</c:if> ">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-md-2">背景图片</label>
        <div class="col-md-10">
            <input type="hidden" name="bigimg" value="${model.bigimg}"/>
            <input type="file" class="btn btn-primary" id="bigimg" name="BigImgFile"/>
            <img src="http://img.readerday.com/cover/${model.bigimg}" class="thumbnail" style="height: 200px;
            <c:if test="${model.bigimg==null}">display: none;</c:if> ">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-md-2">一句话</label>
        <div class="col-md-10">
            <input type="text" id="contentabstract" name="contentabstract" class="form-control" placeholder="请输入一句话"
                   value="${model.contentabstract}"/>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-md-2">内容</label>
        <div class="col-md-10">
            <textarea id="content" name="content" style="width:100%;height: 200px">${model.content}</textarea>
        </div>
    </div>
    <div class="form-group">
        <div class="col-md-offset-2 col-md-10">
            <button type="submit" class="btn btn-primary">
                <i class="fa fa-floppy-o"></i> 保存
            </button>
        </div>
    </div>
</div>
<jsp:include page="/public/inc/ueditor.jsp"/>
<link rel="stylesheet" type="text/css" href="https://res.wx.qq.com/open/libs/weui/0.4.3/weui.css"/>
<script type="text/javascript">
    $(document).ready(function () {
        UE.getEditor('content');

        $("#activity2_end_time").datetimepicker({
            format: "yyyy-mm-dd hh:ii:ss",
            language: "zh-CN",
            autoclose: true,
            startView: 'month',
            todayHighlight: true,
            showMeridian: true,
            todayBtn: 'linked'//今天按钮
        });

        $("#form1").bootstrapValidator({
            feedbackIcons: {
                valid: 'glyphicon glyphicon-ok',
                invalid: 'glyphicon glyphicon-remove',
                validating: 'glyphicon glyphicon-refresh'
            },
            fields: {
                title: {
                    validators: {
                        notEmpty: {
                            message: '不能为空'
                        },
                        stringLength: {
                            max: 500,
                            message: '长度过长'
                        }
                    }
                },
                book_list: {
                    validators: {
                        notEmpty: {
                            message: '不能为空'
                        }
                    }
                },
                price: {
                    validators: {
                        regexp: {
                            regexp: /^(([1-9]\d*)|0)(\.\d{1,2})?$/,
                            message: '只能输入不超过两位小数的正实数'
                        }

                    }
                },
                original_price: {
                    validators: {
                        regexp: {
                            regexp: /^(([1-9]\d*)|0)(\.\d{1,2})?$/,
                            message: '只能输入不超过两位小数的正实数'
                        }

                    }
                },
                sort: {
                    validators: {
                        stringLength: {
                            max: 5,
                            message: '长度过长'
                        },
                        regexp: {
                            regexp: /^\+?(0|[1-9][0-9]*)$/,
                            message: '非负整数'
                        }
                    }
                },
                status: {
                    validators: {
                        regexp: {
                            regexp: /^[0-1]*$/,
                            message: '必须选择启用或禁用中的一个'
                        }
                    }
                },
                ishost: {
                    validators: {
                        regexp: {
                            regexp: /^[0-1]*$/,
                            message: '必须选择是或否中的一个'
                        }
                    }
                },
                type: {
                    validators: {
                        notEmpty: {
                            message: '不能为空'
                        }
                    }
                }
            }
        });
    });
</script>